<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <script src="../lib/react.js"></script>
  <script src="../lib/react-dom.js"></script>
  <script src="http://cdn.bootcss.com/babel-core/5.8.38/browser.min.js"></script>
</head>
<body>
  <div id="app"></div>

  <script type="text/babel">
    var MyComponent = React.createClass({
      getInitialState() {
        return {
          opacity: 1
        }
      },
      componentDidMount() {
        let timer = null,
         opacity = this.state.opacity;
        clearInterval(timer);

        timer = setInterval(() => {
          opacity -= 0.05;

          if(opacity < 0.1) {
            opacity = 1;
          }

          this.setState({
            opacity: opacity
          })
        }, 100)
      },
      render() {
        return <div style={{opacity: this.state.opacity}}>
          <p>{`props:${this.props.name}`}</p>
        </div>
      }
    })

    ReactDOM.render(
      <MyComponent name="React"/>,
      document.querySelector("#app")
    )
  </script>
</body>
</html>